-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add view transitions in WP Admin #10699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Add view transitions in WP Admin #10699
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
src/wp-includes/view-transitions.php
Outdated
| * @return string The CSS. | ||
| */ | ||
| function wp_get_view_transitions_admin_css(): string { | ||
| $css = <<<CSS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to have this CSS in a file and then load it? See what is being merged soon in #10676
This would enable CSS linting as well as minification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point! Will update to move this to a CSS file. Just would want to make sure that that file never gets loaded as its own HTTP request since that would be somewhat pointless with its 2 lines or so :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started working on this locally, but I think because this is "very" modern CSS, I think Core's linters don't like it because they're probably outdated.
I'm not familiar with that tooling, so I'm unsure whether we can simply update it or whether that would introduce a new set of problems to address. Do you have any insights on this?
Specifically, it's complaining about the <custom-ident> bit: ") expected" 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, CSS validation in the Customizer and Site Editor are outdated I know. See Core-64418. With the CSS linter, can it be suppressed with a comment? Which tool is failing? Maybe we can update the dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Humm, I tried adding a src/wp-admin/css/view-transitions.css file containing:
@view-transition {
navigation: auto;
}
#adminmenu > .menu-top {
view-transition-name: attr( id type(<custom-ident>), none );
}Then I ran npm run build:dev and it successfully emitted a src/wp-admin/css/view-transitions.min.css containing:
/*! This file is auto-generated */
@view-transition{navigation:auto}#adminmenu>.menu-top{view-transition-name:attr(id type(<custom-ident>),none)}So it seems to be working fine.
|
@westonruter Do you have an idea how to best fix https://github.com/WordPress/wordpress-develop/actions/runs/20884023219/job/60004547145?pr=10699 or why it fails? My hunch is that it's because the |
|
@felixarntz That's strange, because for the E2E test it does a full build, right? For running PHPUnit tests, I know a build isn't done, and this causes all kinds of headaches when wordpress-develop/tests/phpunit/tests/formatting/emoji.php Lines 18 to 19 in 376539e
But I don't see how this would be needed for E2E tests if they were working correctly with |
|
To debug whether the build is the problem, maybe temporarily change: $affix = SCRIPT_DEBUG ? '' : '.min';To: $affix = ''; |
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @felixarntz for the PR! Overall look solid to me. Left some feedback/Questions.
| $path = ABSPATH . "wp-admin/css/view-transitions{$affix}.css"; | ||
| return file_get_contents( $path ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $path = ABSPATH . "wp-admin/css/view-transitions{$affix}.css"; | |
| return file_get_contents( $path ); | |
| $path = ABSPATH . "wp-admin/css/view-transitions{$affix}.css"; | |
| if ( ! file_exists( $path ) || ! is_readable( $path ) ) { | |
| return ''; | |
| } | |
| return file_get_contents( $path ); |
Should we check whether the file exists and return an empty string if it doesn’t?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we needs to add filter so we can extend the CSS? Something like:
return apply_filters( 'wp_view_transitions_admin_css', file_get_contents( $path ) );
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check whether the file exists and return an empty string if it doesn’t?
It should exist. If not, it's an error. We don't do a file_exists() check in _print_emoji_detection_script(), for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.
wp-view-transitions-adminwith inline CSS for basic view transitions in WP Admin, including smooth transitions between admin menu items.admin_enqueue_scriptsby default.view-transitions.phpfile rather than the genericscript-loader.phpfile.Trac ticket: https://core.trac.wordpress.org/ticket/64470
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.